/**
 * @author: wq
 * @Date: 2017/7/5
 * @Time: 16:30
 * <p>
 * Description:
 *          ***
 */
import axios from 'axios';
import {API_NEW_VERSION} from '../api';

const TRANSIT_EPIBOLYS = API_NEW_VERSION + 'transit/epibolys';
const TRANSIT_EPIBOLYS_TRANSFER_GROUP = API_NEW_VERSION + 'transit/epibolys/transfer/group';
const TRANSIT_EPIBOLYS_LOGS = API_NEW_VERSION + 'transit/epiboly/logs';
const TRANSIT_EPIBOLYS_REJECT_LOGS = API_NEW_VERSION + 'transit/epiboly/reject/logs';
const TRUNK_TASKS_SHIPMENTS_REGION_AND_NUM_AWAIT_TRANSIT_EPIBOLY = API_NEW_VERSION + 'trunk_tasks_shipments_region_and_num/await_transit_epiboly';
const TRUNK_TASKS_SHIPMENTS_REGION_AND_NUM_AWAIT_TRANSIT_EPIBOLY_DATAS = API_NEW_VERSION + 'trunk_tasks_contain_loading_list_trunk_task/await_transit_epiboly/datas';

/**
 * 获取待中转分组
 * @param params
 * @returns {AxiosPromise}
 */
export const shipmentsRegionAndNum = params => {
  return axios.get(TRUNK_TASKS_SHIPMENTS_REGION_AND_NUM_AWAIT_TRANSIT_EPIBOLY, {params: params});
};
/**
 * 获取待中转分组数据
 * @param params
 * @returns {AxiosPromise}
 */
export const trunkTasksPage = params => {
  return axios.get(TRUNK_TASKS_SHIPMENTS_REGION_AND_NUM_AWAIT_TRANSIT_EPIBOLY_DATAS, {params: params});
};
/**
 * 保存中转外包
 * @param params
 * @returns {AxiosPromise}
 */
export const saveTransitEpibolys = params => {
  return axios.post(TRANSIT_EPIBOLYS, params);
};
/**
 * 保存中转外包日志
 * @param params
 * @returns {AxiosPromise}
 */
export const saveTransitEpibolysLog = params => {
  return axios.post(TRANSIT_EPIBOLYS_LOGS, params);
};
/**
 * 保存中转外包拒绝日志
 * @param params
 * @returns {AxiosPromise}
 */
export const saveTransitEpibolysRejectLog = params => {
  return axios.post(TRANSIT_EPIBOLYS_REJECT_LOGS, params);
};
/**
 * 获取当前中转分组数据
 * @param params
 * @returns {AxiosPromise}
 */
export const thisTransferGroup = params => {
  return axios.get(TRANSIT_EPIBOLYS_TRANSFER_GROUP, {params: params});
};

/**
 * 获取当前中转的数据详情
 * @param params
 * @returns {AxiosPromise}
 */
export const searchThisTransferDetail = params => {
  return axios.get(TRANSIT_EPIBOLYS, {params: params});
};
/**
 * 获取历史中转的数据详情
 * @param params
 * @returns {AxiosPromise}
 */
export const searchHistoryTransferDetail = params => {
  return axios.get(TRANSIT_EPIBOLYS_LOGS, {params: params});
};

/**
 * 删除中转中数据
 * @param params
 * @returns {AxiosPromise}
 */
export const deleteThisTransferDetail = (typeIdList) => {
  return axios.delete(TRANSIT_EPIBOLYS, {
    data: typeIdList
  });
};
